home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / vbbook.arc / VBBINP.FRM (.txt) < prev    next >
Visual Basic Form  |  1991-09-06  |  19KB  |  423 lines

  1. VBBinp
  2. PC Book Input
  3. Form1
  4. Print Filename on each Page
  5. Do It
  6. Print Date/Time on each Page
  7. Print Page Numbers
  8. Cancel
  9. Cancel
  10. Use Speaker
  11. Set Line Wrap On
  12. Drive1
  13. File1
  14. Outname
  15. Output To:
  16. comboutname
  17. Picture1
  18. wwwwwwwwwwwwwwp
  19. wwwwwwwwwwwwwp
  20. Combooutname_Change
  21. go_click
  22. pcbook'
  23. Check1_Click
  24.     go2_clickN
  25. ptrarrayY
  26.     ErrorDept
  27. OUTFILE\
  28.     JustCount#
  29. PC_LineLen,
  30. filename:
  31. PC_CurDateJ
  32. PC_DoHeadero
  33. PC_FileTitle{
  34. PC_PgNumber
  35. PC_LineWrap:
  36. OutHere
  37. GetName
  38. Title
  39. Default
  40. NewName.
  41. pcbinp
  42. BuildArray
  43. pages
  44. KeyIn
  45. PrintSetupW
  46. LeftSide
  47.     RightSide
  48.     FirstPass
  49. DoPass
  50. Bookmark
  51. NextPage
  52. DoMacro
  53. LJLocate
  54. HeaderM
  55. Buffer3
  56.     NextPage1a
  57. WaitKey
  58. abort
  59. PrtReset
  60. ERDEV
  61. AWayOut
  62. Flags
  63. pgcount@
  64. MaxLines
  65. Offset
  66.     TotalSize
  67. FileLeft
  68. MemAvail
  69. SixteenK
  70. BufAvail
  71. BuffSizeJ
  72. LnCount
  73. GetPage
  74. stptr
  75. LastLineT
  76.     PageCheck
  77. TempLn|
  78. temppg
  79.     PageBreak6
  80. EndBuild}
  81. Label1_load
  82. EndMacro
  83. PTemp
  84. @    printlogo
  85. StartMacro
  86. Form_Click
  87. Dir1_Change
  88. file1
  89. patht
  90. Dir1_Click}
  91. lastchange
  92. dirsboxclick>
  93. fileboxclickb
  94. File1_ClickM
  95. frame1
  96. caption
  97. File1_DblClick
  98. button_Click
  99. button
  100. index
  101.     listindex@
  102. drive1l
  103. drive
  104. inname
  105. Inname_DragDrop
  106. Source
  107. clk1_Click
  108. clk2_Click
  109. clk3_Click
  110. clk4_ClickU
  111. clk5_Clickg
  112. Outname_DragDropb
  113.     PCBOUTPUT
  114.     scroutput
  115. PCBOUT
  116. Drive1_Change
  117. Cancel_Click
  118. comboutname_Change
  119. @    Form_Load
  120. comboutname
  121. comboutname_Click
  122. comoutname
  123. Click>
  124. abortit
  125. Dennisi
  126. Scott,
  127. ustCountP
  128. lengthW
  129. padspc
  130. Functionpad
  131. msglen
  132. Picture1_Click
  133. VBbinp
  134. vbbout
  135. PCLineWrap
  136.     PCLineLen
  137. PCFileTitle
  138. PCPgNumber
  139.     PCCurDate
  140. PCDoHeader
  141. false
  142. value
  143. comboutname_GotFocus
  144. comboutname_LostFocus
  145. LineWrap
  146. LineLen
  147.     FileTitle
  148. PgNumber
  149. CurDate
  150. DoHeader
  151. BuildArray
  152. Maximum number of lines)
  153. Start of file (seek point)
  154. Open file to check
  155. Get LEN of file so we don't read too far
  156. Setup a counter to show whats left
  157. FRE is not supported by VB.  Just set it to 64Kb
  158. FRE(FileName$) - 2048
  159.  'Check available string memory
  160. Force out of memory error
  161. Set a buffer sizer
  162. If the file is larger than 16K
  163. Set it to 16ks
  164. Otherwise set it to file sizeo
  165. Initialize page counts
  166. First pointer is always 1a
  167. Initialize line countl
  168. Read the filea
  169. Check amount left to readl
  170. If less than our buffer, use lessor
  171. Otherwise use full buffer size
  172. Read in a buffers worthf
  173. Pointer into buffer$
  174. remember last position
  175. Position of next linefeeds
  176. Position of next pagefeeds
  177. If there was a page feed
  178.   was it before our linefeed?r
  179.   yes then bump page count
  180.   set next array element
  181.   set instr pointer 
  182.   reset linecountf
  183. and loop back for more
  184. Linefeed
  185. If Line Wrap, check length
  186. Greater than 80?
  187. check for line wrapr
  188. increment line
  189. > 66 lines
  190. Increment page count
  191. Too may pages - printing only 512.
  192. Notice
  193. point to next in point in file
  194. point ahead 1 byte for next scan
  195. keep checking 
  196. Pointer into file (tally)n
  197. Reset Buffer pointer
  198. Calculate how much is left
  199. If more text in file, keep going
  200. Set last pointer to end of fileg
  201. Close input file
  202. End of BuildArray Sub 
  203. Label1_load
  204. This section is not used at this timee
  205. PCBook - PC Magazine Booklet Printing Utility"u
  206. Copyright 1990 PC Magazine  Ziff Davis  Jay Munro"u
  207. Converted to Visual Basic by Dennis Scott"u
  208. DoMacro
  209. y2X"t
  210. execute the macro
  211. EndMacro
  212. y1X"t
  213. Send end of macro command 
  214. y9X"t
  215. Make it temporary (10 to be permanent)
  216. Header
  217. Create a string to print
  218. Print the filename
  219. Print the current page
  220. odd page, right side
  221. even page, left side
  222. Print the current date
  223. even page, left side
  224. odd page, right side
  225. Print the Header
  226.  and skip a line for readability
  227. LJLocate
  228. Laser Jet cursor locatee
  229. printlogo
  230. Banner logo
  231.                    VB Book
  232.      Converted to Visual Basic
  233.              by Dennis Scott."
  234. Send Comments/Suggestions to:"
  235.                CompuDirect
  236.              9102 Ocean Gate
  237.               San Antonio, TX"
  238.                (512)623-6856
  239. About VB Book"
  240. PrintSetup
  241. Send codes to prepare printerd
  242. Reset laserjet (simple isn't it!)r
  243. &l1o5.45C"t
  244. Select lineprinter font"
  245. (s0p16.66Ht
  246.   and pitchp
  247. &l0Lt
  248. Turn off page feed at 66 lines
  249. Wrap lines > 80 chars 
  250. &s0Ct
  251. &l2Et
  252. Top margin 2 lines
  253. Left side macro
  254. Reset left - right margins
  255. &a0l80M"t
  256. set left margin 0, right 80
  257. Right side macro
  258. Reset left - right margins
  259. &a95l175M"t
  260. set left margin 95, right 175 
  261. StartMacro
  262. Macro will have an id of Num$ 
  263. &f0Xt
  264. Start the macro nowr
  265. Form_Click
  266. If user clicks on the form, call the about box
  267. go_click
  268. This is the main code - everything is actually called from here
  269. Code for Drive, Directory, and File selections
  270. Sorry!  You must first select a file."
  271. No application chosen.
  272. cancel buttonc
  273. total number of pages (512) 
  274. Error trapping
  275. Ensure that we have a file name (user may have clicked DoIt withoutt
  276. entering a filename)
  277. Enter a file name to print: 
  278. Filename
  279.  Set title.n
  280.  Get user input.
  281.  Check if valid.
  282. You did not input a valid Filename."
  283. Click on OK to End Program
  284.  Display message. 
  285. FOR TESTING:
  286. PC.LineWrap = 0p
  287. Build index array for pages in FileName$
  288. Have not converted status display
  289. Print
  290. Print "Reading file "; filename$
  291. Built pointer arrayF
  292. Figure number of pages neededn
  293. Even multiples of 4 only
  294.   correct for less
  295. Have not converted status display
  296. Printn
  297. Print "You will print "; Page% \ 4; "sheets" 'Report total number of pages
  298. Print 
  299. JustCount% is set to false always due to status section not beinge
  300. converted to VBe
  301. Press any key to continue, or ESC to cancel printingu
  302. Open printer or output file
  303. Set up printer
  304. Page parsing variables
  305. Open the input filep
  306. Have not converted status displayi
  307. Print "Printing Side 1 to "; outfile$;
  308.  'Track what is going on
  309. Start of print routine
  310. Flag for halfway through
  311. Force 1 if too small
  312. Read text and send to printer or file;
  313. Print the right side of the page first
  314. If blank, then skip it
  315. Start on right siden
  316. Home the cursorg
  317. Header if needed
  318. Read in a page
  319. If the last character is a PFt
  320. print only texth
  321. Otherwise print full liney
  322. Don't print blank pages
  323. Reset margins for left sidee
  324. Home the cursorg
  325. Header if needed
  326. Setup buffer for input
  327. If pointing at blank page, skipr
  328. Read in a page
  329. if the last character is a PFr
  330. print only texti
  331. print only text
  332. otherwise print alln
  333. Page feed 
  334. Calculate next page in seriesi
  335. Track our progress
  336. Print pages until halfway throught
  337. Pause between sides to allow for paper reinsertion
  338. If side one, prompt and get 2nd side
  339. First Pass has been Completed.
  340. Insert paper back in tray and Click OK
  341. Press any key to continue loop
  342. Waiting"
  343. Flag for second pass
  344. Have not converted status display
  345. msg$ = "Printing Side 2 to " + outfile$t
  346. Print msg$
  347.   'Report on progress
  348. End of first pass 
  349. Printing is done now
  350. Printing completed."
  351. Reset laserjet
  352. Close all files"
  353. Thats all for noww
  354. Error handlero
  355. *** Error ***"
  356. Printer error.
  357. Device is unavailable.
  358. Insert a disk in the drive and close the door.
  359. Device Input/Output Error (Check Printer!)."
  360. Disk is full."
  361. That filename is illegal."
  362. That path doesn't exist.
  363. Can't open your file for that type of access."
  364. This file is already open.
  365. This file has a nonstandard end-of-file marker
  366. or an attempt was made to read beyond the end-
  367. of-file marker."
  368. Error number "
  369. ERROR"
  370. If user presses Cancel, Exit
  371. End of main module
  372. Dir1_Change
  373. Dir1_Click
  374. File1_Click
  375. use the following line to put filename in framef
  376. if using a frame: 
  377. inname.caption = "Load " + file1.filenamee
  378. File1_DblClick
  379. clk1_Click
  380. Toggle on/offe
  381. Still have to do the Header if clk2 or clk3 buttons are checked
  382. clk2_Click
  383. Toggle on/offT
  384. Still have to do the Header if clk1 or clk3 buttons are checked
  385. clk3_Click
  386. Toggle on/offT
  387. Still have to do the Header if clk1 or clk2 buttons are checked
  388. clk4_Click
  389. Toggle on/offT
  390. clk5_Click
  391. Toggle on/offT
  392. Drive1_Change
  393. Cancel_Click
  394. If user clicks on the cancel button then ...
  395. Form_Load
  396. Set up the output combo boxo
  397. default to LPT1e
  398. set default check-box values
  399. set some variables
  400. Standard ESC codet
  401. Page Feed
  402. Line Feed 
  403. CR and LFd
  404. Not allowing "just counting"
  405. Maximum length of line
  406. comboutname_Click
  407. Select where to send the output
  408. LPT1&
  409. LPT2&
  410. COM1&
  411. COM2&
  412. file&
  413. You must select an input filename first!
  414. set focus to file list box
  415. Now make up a default output filename with same name and PRN as extensionn
  416. Enter filename to print to:"
  417. Output File Name
  418. Get a filename
  419. put filename in combo boxU
  420. set focus to file list box
  421. Picture1_Click
  422. Show the "about" box
  423.